package com.egao.common.publicly;

import com.egao.common.core.annotation.ApiPageParam;
import com.egao.common.core.web.BaseController;
import com.egao.common.core.web.JsonResult;
import com.egao.common.core.web.PageParam;
import com.egao.common.core.web.PageResult;
import com.egao.common.module.company.entity.MutualInvitation;
import com.egao.common.module.company.service.MutualInvitationService;
import com.egao.common.publicly.utils.CalendarUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author lym
 * @date 2024/1/2 15:29
 */
@Api(tags = "双选会邀请函")
@RestController
@RequestMapping("${api}")
public class PubliclyMutualInvitationController extends BaseController {

    @Autowired
    private MutualInvitationService mutualInvitationService;

    @ApiOperation(value = "双选会邀请函信息", notes = "创建时间倒序")
    @ApiPageParam
    @GetMapping("/publicly/mutual-invitation/page")
    public PageResult<MutualInvitation> page(HttpServletRequest request) {
        PageParam<MutualInvitation> pageParam = new PageParam<>(request);
        CalendarUtils.putTime(pageParam);
        return new PageResult<>(mutualInvitationService.listPage(pageParam), pageParam.getTotal());
    }


    @ApiOperation(value = "获取双选会邀请函信息详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "双选会邀请函信息id", required = true, dataType = "int")
    })
    @GetMapping("/publicly/mutual-invitation/detail")
    public JsonResult detail(Integer id) {
        return mutualInvitationService.detail(id);
    }
}
